#!/bin/sh
[ -z "$2" ]  && echo "Usage: ${0##*/} file filter [filter args..]" 2>&1  && exit 1
F="$1"; shift; T="`mktemp`"  || exit 1
"$@" < "$F" >> "$T"  && mv -fT -- "$T" "$F"  && exit 0
[ -e "$T" ]  && rm "$T"; exit 1
